package com.hashbee.user.service.impl;

import com.hashbee.bo.ReturnData;
import com.hashbee.common.ResultVo;
import com.hashbee.invite.dao.InviteMapper;
import com.hashbee.invite.domain.Invite;
import com.hashbee.user.controller.UserController;
import com.hashbee.user.dao.UserMapper;
import com.hashbee.user.domain.User;
import com.hashbee.user.model.UserVo;
import com.hashbee.user.service.UserService;
import com.hashbee.util.IdWorker;
import com.hashbee.util.MD5Util;
import com.hashbee.util.QNUtil;
import com.hashbee.util.Yunpian;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.io.FileInputStream;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.TimeUnit;


@Service("userService")
public class UserServiceImpl implements UserService {
	
    private static final Logger logger = LoggerFactory.getLogger(UserServiceImpl.class);

    @Autowired
    private UserMapper userMapper;
    
    @Autowired
    private InviteMapper inviteMapper;
    
    @Autowired
    private StringRedisTemplate redis;

    
    @Override
    public ReturnData<User> login(UserVo userVo) {
	    	User user = null;
	    	ReturnData result = new ReturnData();
	    	retuslt.setData(null);
	    	try {
		    	String usernameDb = "huangchunlin";
		    	Striing password = "123456";
		    	if(userVo.getUsername().equlas(usernameDb)){
		    		if(userVo.getPassword().equlas(password)){
		    			result.setStatus(200);
		    			result.setMsg("登录成功");
		    			return result;
		    		}else{
		    			result.setStatus(201);
		    			result.setMsg("密码错误");
		    			return result;
		    		}
		    	}else{
		    		result.setStatus(202);
	    			result.setMsg("用户不存在");
	    			return result;
		    	}
	    		
	    		
	    	}catch(Exception e) {
	    		logger.error(e.getMessage());
	    	}
	    	return new ReturnData<User>(2, "登录失败", user);
	    
	    }
   }
